/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.controlcobros.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Maricela
 */
@Entity
@Table(name = "pagos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pagos.findAll", query = "SELECT p FROM Pagos p"),
    @NamedQuery(name = "Pagos.findById", query = "SELECT p FROM Pagos p WHERE p.id = :id"),
    @NamedQuery(name = "Pagos.findByFecha", query = "SELECT p FROM Pagos p WHERE p.fecha = :fecha"),
    @NamedQuery(name = "Pagos.findByHora", query = "SELECT p FROM Pagos p WHERE p.hora = :hora"),
    @NamedQuery(name = "Pagos.findBySemana", query = "SELECT p FROM Pagos p WHERE p.semana = :semana"),
    @NamedQuery(name = "Pagos.findBySemanasPagar", query = "SELECT p FROM Pagos p WHERE p.semanasPagar = :semanasPagar"),
    @NamedQuery(name = "Pagos.findByColegiatura", query = "SELECT p FROM Pagos p WHERE p.colegiatura = :colegiatura"),
    @NamedQuery(name = "Pagos.findByDescuento", query = "SELECT p FROM Pagos p WHERE p.descuento = :descuento"),
    @NamedQuery(name = "Pagos.findByRecargo", query = "SELECT p FROM Pagos p WHERE p.recargo = :recargo"),
    @NamedQuery(name = "Pagos.findByTotalPago", query = "SELECT p FROM Pagos p WHERE p.totalPago = :totalPago"),
    @NamedQuery(name = "Pagos.findByUser", query = "SELECT p FROM Pagos p WHERE p.idUsuario.id = :idUsuario")
})
public class Pagos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hora")
    @Temporal(TemporalType.TIME)
    private Date hora;
    @Basic(optional = false)
    @NotNull
    @Column(name = "semana")
    private int semana;
    @Basic(optional = false)
    @NotNull
    @Column(name = "semanasPagar")
    private int semanasPagar;
    @Basic(optional = false)
    @NotNull
    @Column(name = "colegiatura")
    private int colegiatura;
    @Basic(optional = false)
    @NotNull
    @Column(name = "descuento")
    private int descuento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "recargo")
    private int recargo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "totalPago")
    private int totalPago;
    @JoinColumn(name = "idUsuario", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Usuario idUsuario;

    public Pagos() {
    }

    public Pagos(Integer id) {
        this.id = id;
    }

    public Pagos(Integer id, Date fecha, Date hora, int semana, int semanasPagar, int colegiatura, int descuento, int recargo, int totalPago) {
        this.id = id;
        this.fecha = fecha;
        this.hora = hora;
        this.semana = semana;
        this.semanasPagar = semanasPagar;
        this.colegiatura = colegiatura;
        this.descuento = descuento;
        this.recargo = recargo;
        this.totalPago = totalPago;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public int getSemana() {
        return semana;
    }

    public void setSemana(int semana) {
        this.semana = semana;
    }

    public int getSemanasPagar() {
        return semanasPagar;
    }

    public void setSemanasPagar(int semanasPagar) {
        this.semanasPagar = semanasPagar;
    }

    public int getColegiatura() {
        return colegiatura;
    }

    public void setColegiatura(int colegiatura) {
        this.colegiatura = colegiatura;
    }

    public int getDescuento() {
        return descuento;
    }

    public void setDescuento(int descuento) {
        this.descuento = descuento;
    }

    public int getRecargo() {
        return recargo;
    }

    public void setRecargo(int recargo) {
        this.recargo = recargo;
    }

    public int getTotalPago() {
        return totalPago;
    }

    public void setTotalPago(int totalPago) {
        this.totalPago = totalPago;
    }

    public Usuario getIdUsuario() {
        return idUsuario;
    }

    public void setIdUsuario(Usuario idUsuario) {
        this.idUsuario = idUsuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pagos)) {
            return false;
        }
        Pagos other = (Pagos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itschapala.dsw2.controlcobros.modelo.Pagos[ id=" + id + " ]";
    }
    
}
